<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="vue.min.js"></script>
</head>
<body>
<div id="div1">
    <button-tag v-on:tagclick="onTagClick"></button-tag>
</div>
<script>
    Vue.component("button-tag",{
        template : "<button v-on:click='myClick'>点我</button>",
        methods : {
            myClick : function () {
                //组件的button点击时触发一个tagclick事件
                this.$emit("tagclick");
            }
        }
    });

    var vm = new Vue({
        el : "#div1",
        methods : {
            onTagClick : function () {
                alert("自定义事件");
            }
        }
    })
</script>
</body>
</html>